package com.atguigu.spzx.model.entity.system;

public class AuthContextUtil {

    final static ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    public static SysUser getUser(){
        // 返回当前登录的用户数据
        SysUser sysUser = threadLocal.get();
        return sysUser;
    }

    public static void setUser(SysUser sysUser){
        // 设置当前登录用户的数据
        threadLocal.set(sysUser);
    }

    public static void clear(){
        threadLocal.remove();
    }
}
